﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Swin_e_mon_Forms
{
    class MoveCommand: Command
    {
        public MoveCommand(SwinEForm f)
            : base(new string[] {"Move", "Go"}, f)
        { }

        public override string Run(Player p, string[] input)
        {
            if ((input[0].ToLower() == "move" || input[0].ToLower() == "go") && input.Count() == 2)
                return Move(p, input[1]);
            return "Do not know how to move that way!";
        }

        public string Move(Player p,string id)
        {
            if (p.InLocation.LocatePath(id) == null)
                return "Cannot move that way!";
            f.ClearLocList();
            return p.MoveVia(id);
        }
    }
}
